<template>
  <div>
    <div class="antd_container">
      <div class="content">
        <div class="top">
          <div class="header">
            <img alt="logo" class="logo" src="@/assets/min-logo-b.png"/>
            <span class="title">后台系统模板</span>
          </div>
          <div class="desc">让一切来的更得心应手</div>
        </div>
        <div class="login">
          <a-form @submit="handleSubmit">
            <a-tabs size="large" :tabBarStyle="{textAlign: 'center'}" style="padding: 0 2px;">
              <a-tab-pane tab="账户密码登录" key="1">
                <a-alert type="error" :closable="true" v-show="error" :message="error" showIcon
                         style="margin-bottom: 24px;"/>
                <a-form-item>
                  <a-input size="large" v-model="form.userName" placeholder="账户名">
                    <a-icon slot="prefix" type="user"/>
                  </a-input>
                </a-form-item>
                <a-form-item>
                  <a-input size="large" v-model="form.password" placeholder="密码" type="password">
                    <a-icon slot="prefix" type="lock"/>
                  </a-input>
                </a-form-item>
              </a-tab-pane>
            </a-tabs>
            <div>
              <a-checkbox v-model="psdFlag">记住密码</a-checkbox>
              <a style="float: right" @click="forgetPsd">忘记密码</a>
            </div>
            <a-form-item>
              <a-button :loading="logging" style="width: 100%;margin-top: 24px" size="large" htmlType="submit"
                        type="primary">登录
              </a-button>
            </a-form-item>
          </a-form>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import origin from './menus'

  export default {
    data() {
      return {
        logging: false,
        form: {
          userName: 'admin',
          password: 'admin'
        },
        psdFlag: true
      };
    },
    mounted() {

    },
    methods: {
      forgetPsd() {
        this.$Message.info({
          content: '请联系管理员进行信息查实找回',
          duration: 6,
          closable: true
        });
      },
      handleSubmit(e) {
        e.preventDefault();
        this.$Spin.show({
          render: (h) => {
            return h('div', [
              h('loading'),
            ])
          }
        });
        let serialNumbers = [];
        origin.map((item) => {
          serialNumbers.push(item.serialNumber)
        });
        setTimeout(() =>{
          this.$Spin.hide();
          this.$ls.set('SESSION_ID', 'session');
          this.$ls.set('realName', '徐斌松');
          this.$ls.set('user', 'admin');
          this.$ls.set('phone', '18651035010');
          this.$ls.set('company', '中科软科技股份有限公司');
          this.$ls.set('email', 'iamxbs@aliyun.com.cn');
          this.$ls.set('access', serialNumbers.join(','));
          this.$store.commit('setAvator', 'static/image/boy.png');
          this.$router.push({
            name: 'protocol_dealInput'
          });
        },1000)
      }
    }
  };
</script>
<style lang="less" scoped>
  .antd_container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: auto;
    background: #f0f2f5 url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg') no-repeat center 110px;
    background-size: 100%;

    .content {
      padding: 32px 0;
      flex: 1;
      @media (min-width: 768px) {
        padding: 112px 0 24px;
      }

      .top {
        text-align: center;

        .header {
          height: 44px;
          line-height: 44px;

          a {
            text-decoration: none;
          }

          .logo {
            height: 44px;
            vertical-align: top;
            margin-right: 6px;
          }

          .title {
            font-size: 33px;
            color: rgba(0, 0, 0, .85);
            font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
            font-weight: 600;
            position: relative;
            top: 2px;
          }
        }

        .desc {
          font-size: 14px;
          color: rgba(0, 0, 0, .45);
          margin-top: 12px;
          margin-bottom: 40px;
        }
      }

      .login {
        width: 368px;
        margin: 0 auto;
        @media screen and (max-width: 576px) {
          width: 95%;
        }
        @media screen and (max-width: 320px) {
          .captcha-button {
            font-size: 14px;
          }
        }

        .icon {
          font-size: 24px;
          color: rgba(0, 0, 0, 0.2);
          margin-left: 16px;
          vertical-align: middle;
          cursor: pointer;
          transition: color 0.3s;

          &:hover {
            color: #1890ff;
          }
        }
      }
    }
  }
</style>
